<?php if (!defined('THINK_PATH')) exit();?><html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   <!-- <link href="../static/bootstrap/css/bootstrap-responsive.css" rel="stylesheet" type="text/css"/>
    <link href="../static/bootstrap/css/docs.css" rel="stylesheet" type="text/css"/>
    -->
   <link href="/static/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css"/>
   <link href="/static/viewback/css/mycss.css" rel="stylesheet" type="text/css"/>
   <title>帖子详情</title>
</head>
<body>
<!--<div id="banner"><h2 style="color: blue">论坛后台管理系统</h2>

</div>
    <div class="row-fluid">
       <div style="margin-left:50px;margin-top: 10px;float: left">欢迎管理员<a href="/Admin/user/userInfo?id=<?php echo $_SESSION['userInfo']['id'] ?>"><?php if($_SESSION['userInfo']['role']=='管理员'){echo $_SESSION['userInfo']['username'];}else{header("location:/User/user/login");} ?></a>登录</div>
       <div style="float:right;margin-right: 20px;" class="navbar navbar-inner"> 
            <ul class="nav nav-pills" id="top-nav"> 
            <li  id="index"><a href="/User/forum/forum.html" target="_blank">论坛首页</a></li>
            <li class="divider-vertical"></li>
            <li  id="posts"><a href="/Admin/posts/postsList.html" target="_self">帖子管理</a></li>
            <li class="divider-vertical"></li>
            <li  id="user"><a href="/Admin/user/userList.html" target="_self">会员管理</a></li>
            <li class="divider-vertical"></li>
            <li  id="forum"><a href="/Admin/forum/forumList.html" target="_self">版块管理</a></li>
            <li class="divider-vertical"></li>
            <li  id="logout"><a href="/User/user/logout" target="_self"><i class="icon-off"></i>安全退出</a></li>
           </ul>
       </div>
    </div>

<!--<script type="text/javascript">
    $(document).ready(function(){
        $('li').mouseover(function(){
            $(this).addClass('active');
        });
        $('li').mouseout(function(){
            $(this).removeClass('active');
        });
    });
</script>-->
<script type="text/javascript" src="/static/viewback/js/jquery-1.8.3.js"></script>
<script type="text/javascript">
    var oplist = new Array('index', 'posts', 'user', 'forum', 'logout');
    $(document).ready(function() {
            $('#top-nav').find('a').mouseover(function() {
                    var id = $(this).attr('id');
                    $.each(oplist, function(i, n) {
                            $('#'+n).attr('class', 'inactive');
                    });
                    $(this).parents("li").attr('class', 'active');
            });
    });
</script>
<div class="container-fluid" style="font-weight: 700;">
    <div class="navbar navbar-inverse navbar-fixed-top" style="min-width: 1340px;">
        <div class="navbar-inner">
            <a class="brand" href="#">论坛后台管理系统</a>
            <div class="nav-collapse collapse">
                <p class="navbar-text pull-right" style="margin-right: 100px;">
                   欢迎管理员<a href="/Admin/user/userInfo?id=<?php echo $_SESSION['userInfo']['id'] ?>"><?php if($_SESSION['userInfo']['role']=='管理员'){echo $_SESSION['userInfo']['username'];}else{header("location:/User/user/login");} ?></a>登录
                </p>
               <ul class="nav nav-pills" id="top-nav"> 
                <li  id="index"><a href="/User/forum/forum.html" target="_blank">论坛首页</a></li>
                <li class="divider-vertical"></li>
                <li  id="user"><a href="/Admin/user/userList.html" target="_self">会员管理</a></li>
                <li class="divider-vertical"></li>
                <li  id="posts"><a href="/Admin/posts/postsList.html" target="_self">帖子管理</a></li>
                <li class="divider-vertical"></li>
                <li  id="forum"><a href="/Admin/forum/forumList.html" target="_self">版块管理</a></li>
                <li class="divider-vertical"></li>
                <li  id="logout"><a href="/User/user/logout" target="_self"><i class="icon-off"></i>安全退出</a></li>
               </ul>
            </div>
        </div>
    </div>
</div>
<br/>
<br/>


<ul class="breadcrumb">
    <li>
      <a href="/Admin/user/userList" title="后台管理"><i class="icon-home"></i></a> <span class="divider">/</span>
    </li>
    <li>
      <a href="/Admin/posts/postsList" title="帖子管理">帖子管理</a> <span class="divider">/</span>
    </li>
    <li>
        <a href="/Admin/posts/postsList" title="主题列表">主题列表</a><span class="divider">/</span>
    </li>
    <li class="active"><?php echo ($postsDetail["theme"]); ?></li> 
 </ul>
    <div class="container-fluid">
        <div class="row-fluid">
            <div class="span2"> 
                <div class="well slidebar-nav" style="width:170px;height: auto">
    <ul class="nav nav-list nav-stacked nav-pills">
        <li class="nav-header">会员管理</li>
        <li><a href="/Admin/user/userList">会员列表</a></li>
        <li><a href="/Admin/user/userOnline">在线会员</a></li>
        <li><a href="/Admin/user/userDrop">账号删除</a></li>
        <li class="nav-header">帖子管理</li>
        <li><a href="/Admin/posts/postsList">主题列表</a></li>
        <li><a href="/Admin/posts/postsNew">今日新帖</a></li>
        <li><a href="/Admin/posts/postsGood">精华帖子</a></li>
        <li class="nav-header">版块管理</li>
        <li><a href="/Admin/forum/forumList">版块列表</a></li>
        <li><a href="/Admin/forum/forumAdd">板块增加</a></li>
        <li><a href="/Admin/forum/forumDelete">版块删除</a></li>
        <li class="nav-header">其他</li>
        <li><a href="/Admin/user/userResetPwd">密码重置</a></li>
        <li><a href="/Admin/forum/dataBack">数据备份</a></li>
        <li><a href="/User/user/logout">安全退出</a></li>
    </ul>
</div>
<script type="text/javascript">
    $(document).ready(function(){
        $('li').mouseover(function(){
            $(this).addClass('active');
        });
        $('li').mouseout(function(){
            $(this).removeClass('active');
        });
    });
</script>


   
      
            </div>
            <div class="span10">
                <div class="well" style="background-color: white;">
                    <h3><?php echo ($postsDetail["theme"]); ?></h3>
                    <div style="border-bottom: 1px silver dashed"></div><br/>
                    <span><a href="/Admin/user/userInfo?id=<?php echo ($postsDetail["author_id"]); ?>"><?php echo ($postsDetail["author"]); ?></a>&nbsp;&nbsp;发表于<?php echo ($postsDetail["dateline"]); ?>&nbsp;&nbsp;跟帖数：<?php echo ($replyCount); ?></span><span style="float: right">楼主</span>
                    <br/><pre  style="background-color: white;border: 0px;"><?php echo ($postsDetail["content"]); if(empty($postsDetail["mood"])): echo ($postsDetail["mood"]); else: ?><img src="<?php echo ($postsDetail["mood"]); ?>"/><?php endif; ?></pre><br/>
                    <div style="border-bottom: 1px silver dashed"></div><br/>  
                    <a class="label label-info" id="btn_reply">回复</a>
                    <?php echo ($error); ?>
                </div>
                <div class="well" style="display: none;background-color: white;" id="reply_div"><a class="close" id="reply_div_close">&times;</a>
                    <form class="form-horizontal form-inline" action="/Admin/posts/submitReply" method="post" id="reply_form">
                        <div class="img">
                        <input name="mood" type="radio" value="/static/view/image/mood/001.gif"/><img src="/static/view/image/mood/001.gif"/>
                        <input name="mood" type="radio" value="/static/view/image/mood/002.gif"/><img src="/static/view/image/mood/002.gif"/>
                        <input name="mood" type="radio" value="/static/view/image/mood/003.gif"/><img src="/static/view/image/mood/003.gif"/>
                        <input name="mood" type="radio" value="/static/view/image/mood/004.gif"/><img src="/static/view/image/mood/004.gif"/>
                        <input name="mood" type="radio" value="/static/view/image/mood/005.gif"/><img src="/static/view/image/mood/005.gif"/>
                        <input name="mood" type="radio" value="/static/view/image/mood/006.gif"/><img src="/static/view/image/mood/006.gif"/>
                        <input name="mood" type="radio" value="/static/view/image/mood/007.gif"/><img src="/static/view/image/mood/007.gif"/>
                        <input name="mood" type="radio" value="/static/view/image/mood/008.gif"/><img src="/static/view/image/mood/008.gif"/>
                        <input name="mood" type="radio" value="/static/view/image/mood/009.gif"/><img src="/static/view/image/mood/009.gif"/>
                        <input name="mood" type="radio" value="/static/view/image/mood/010.gif"/><img src="/static/view/image/mood/010.gif"/>
                        <input name="mood" type="radio" value="/static/view/image/mood/011.gif"/><img src="/static/view/image/mood/011.gif"/>
                        <input name="mood" type="radio" value="/static/view/image/mood/012.gif"/><img src="/static/view/image/mood/012.gif"/>
                        <input name="mood" type="radio" value="/static/view/image/mood/013.gif"/><img src="/static/view/image/mood/013.gif"/>
                        </div>
                        <input name="theme_id" type="hidden" value="<?php echo ($postsDetail["id"]); ?>"/>
                        <input name="" type="button" value="h1" id="h1" class="btn btn-mini" title="1号标题"/>
                        <input name="" type="button" value="h2" id="h2" class="btn btn-mini" title="2号标题"/>
                        <input name="" type="button" value="h3" id="h3" class="btn btn-mini" title="3号标题"/>
                        <input name="" type="button" value="h4" id="h4" class="btn btn-mini" title="4号标题"/>
                        <input name="" type="button" value="h5" id="h5" class="btn btn-mini" title="5号标题"/>
                        <input name="" type="button" value="b" id="bold" class="btn btn-mini" title="粗体"/>
                        <input name="" type="button" value="i" id="italics" class="btn btn-mini" title="斜体"/>
                        <input name="" type="button" value="u" id="underline" class="btn btn-mini" title="下划线"/>
                        <a id="apply" class="label label-info">apply</a><br/>
                        <textarea id="selectable" name="content" class="span6" rows="4" required></textarea><br/>
                        <p id="container"></p>
                        <button class="btn-primary btn-small" type="submit">提交回复</button>
                    </form>
                </div>
                <span class="label label-info" id="reply_list_btn" style="cursor: pointer">查看回复</span><br/><br/>
                <div id="reply_list_div">
                    <table class="table table-bordered">
                        <thead><tr><th>用户名</th><th>回复内容</th><th>回复时间</th><th>楼层</th></tr></thead>
                        <tbody>
                            <?php if(is_array($replyList)): $floor = 0; $__LIST__ = $replyList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$replyList): $mod = ($floor % 2 );++$floor;?><tr><td><?php echo ($replyList["author"]); ?></td><td><pre  style="background-color: white;border: 0px;"><?php echo ($replyList["content"]); if(empty($replyList["mood"])): echo ($replyList["mood"]); else: ?><img src="<?php echo ($replyList["mood"]); ?>"/><?php endif; ?></pre></td><td><?php echo ($replyList["dateline"]); ?></td><td>#<?php echo ($floor); ?></td></tr><?php endforeach; endif; else: echo "" ;endif; ?>
                        </tbody>
                    </table>
                    <?php echo ($pagestring); ?>
                </div>
            </div>
        </div>
</div>

<div style="margin:5px 20px;">
	<div style="border-bottom: 1px solid silver"></div>
	<div style="padding:15px 0px;line-height:1.0;">
		<p>Copyright &copy;2012-2013 shaobo,test</p>
		<p>Welcome to our Bulletin Board System.It is our <strong>beta</strong> version,contact <a href="mailto:shaaoboo@sina.com"><font color='blue'>shaaoboo@sina.com</font></a> to give us your valuable suggestion.</p>
	</div>
</div>

<script type="text/javascript" src="/static/bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="/static/viewback/js/jquery-1.8.3.js"></script>
<script type="text/javascript">
     function getPositions(){
        var startPosition=endPosition=0;
        var element=document.getElementById('selectable');
        if(document.selection){
            var range=document.selection.createRange();
            var drange=range.duplicate();
            drange.moveToElementText(element);
            drange.setEndPoint('EndToEnd',range);
            startPosition=drange.text.length-range.text.length;
            endPosition=startPosition+range.text.length;//alert('ie');
        }
        else if(window.getSelection){
            //firefox chrome safari
            startPosition=element.selectionStart;
            endPosition=element.selectionEnd;//alert(endPosition);
        }
        return {'start':startPosition,'end':endPosition};
    }
    //jquery
    $(document).ready(function(){
        $('#reply_div_close').click(function(){
            $('#reply_div').slideUp('slow');
        })
        $('#reply_list_close').click(function(){
            $('#reply_list_div').slideUp('slow');
        })
        $('#reply_list_btn').click(function(){
            $('#reply_list_div').slideToggle('slow');
        })
       $('#btn_reply').click(function(){
           $('#reply_div').slideToggle('slow');
       });
       $('#reply_form').submit(function(){
           if($.trim($('#selectable').val())==''){
               alert('回复内容不能为空');
               return false;
           }
           
       });
       /*格式化文本，给文本选中添加样式，例如斜体，粗体*/
        $('#apply').click(function(){
            $('#container').html($('#selectable').val());
        });
        $('.btn').click(function(){
            var positions=getPositions();
            if(positions.start==positions.end){
                return false;
            }
            var tag=$(this).val();
            var textOnPage=$('#selectable').val();
            var startString=textOnPage.substr(0, positions.start);
            var targetString=textOnPage.substr(positions.start,positions.end-positions.start);
            var formattedString="<" + tag+">" + targetString + "</"+tag+">";
            var endString=textOnPage.substr(positions.end);//alert(endString+'||'+startString+'||'+formattedString);
            $("#selectable").val(startString + formattedString + endString);//alert($("#selectable").val());
        });
        
    });
       
</script>
</body>
</html>